package cn.com.roy.thread.t3_1_12.pipeInputOutput;

import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;

public class RunCls {
    public static void main(String[] args) {
        WriteData writeData = new WriteData();
        PipedOutputStream outputStream = new PipedOutputStream();

        ReadData readData = new ReadData();
        PipedInputStream pipedInputStream  = new PipedInputStream();

        try {
           // outputStream.connect(pipedInputStream);
            pipedInputStream.connect(outputStream);
        } catch (IOException e) {
            e.printStackTrace();
        }



        ThreadRead threadRead = new ThreadRead(readData,pipedInputStream);
        threadRead.start();

        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        ThreadWrite threadWrite = new ThreadWrite(writeData,outputStream);
        threadWrite.start();



    }
}
